Private Sub CreateInvoice()
Dim oInvoice As SAPbobsCOM.Documents
oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInvoice.CardCode = Card Code With DownPayment Invoice
oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
oInvoice.DocDate = Document Date
oInvoice.Lines.ItemCode = Some Item Code
oInvoice.Lines.Price = Item Price
oInvoice.Lines.Quantity = Quantity
oInvoice.Lines.TaxCode = Tax Code If needed
oInvoice.Lines.VatGroup = Vat Code If needed
Dim dpToDraw As SAPbobsCOM.DownPaymentsToDraw
dpToDraw = oInvoice.DownPaymentsToDraw
dpToDraw.AmountToDraw = oDPM.DownPaymentAmount
lRetCode = oInvoice.Add()
If lRetCode <> 0 Then
oCompany.GetLastError(lErrCode, sErrMsg)
MsgBox(lErrCode & " " & sErrMsg)
Else
MsgBox("Invoice with Downpayment created, the process of using a downpayment invoice succeeded", MsgBoxStyle.Information, "Invoice Paid")
cmdInv.Enabled = False
End If
End Sub |